package com.powerbank.common.client;

import com.powerbank.common.result.Result;
import com.powerbank.common.result.PageResult;
import com.powerbank.common.query.PageQuery;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 用户中心服务客户端
 */
@FeignClient(name = "user-center", path = "/users", fallback = UserCenterClientFallback.class)
public interface UserCenterClient {

    /**
     * 根据用户ID获取用户信息
     */
    @GetMapping("/{userId}")
    Result<Map<String, Object>> getUserInfo(@PathVariable("userId") Long userId);
    
    /**
     * 根据用户ID获取用户DTO
     */
    @GetMapping("/{userId}/dto")
    Result<com.powerbank.common.dto.UserDTO> getUserById(@PathVariable("userId") Long userId);

    /**
     * 根据手机号获取用户信息
     */
    @GetMapping("/phone/{phone}")
    Result<Map<String, Object>> getUserByPhone(@PathVariable("phone") String phone);

    /**
     * 检查用户是否存在
     */
    @GetMapping("/{userId}/exists")
    Result<Boolean> checkUserExists(@PathVariable("userId") Long userId);

    /**
     * 获取用户身份认证状态
     */
    @GetMapping("/{userId}/identity/status")
    Result<Map<String, Object>> getIdentityStatus(@PathVariable("userId") Long userId);

    /**
     * 增加用户积分
     */
    @PostMapping("/{userId}/points/add")
    Result<Void> addUserPoints(@PathVariable("userId") Long userId, 
                              @RequestParam("points") Integer points, 
                              @RequestParam("reason") String reason);

    /**
     * 获取用户积分
     */
    @GetMapping("/{userId}/points")
    Result<Integer> getUserPoints(@PathVariable("userId") Long userId);

    /**
     * 禁用用户
     */
    @PutMapping("/{userId}/disable")
    Result<Void> disableUser(@PathVariable("userId") Long userId);

    /**
     * 启用用户
     */
    @PutMapping("/{userId}/enable")
    Result<Void> enableUser(@PathVariable("userId") Long userId);

    /**
     * 分页查询用户列表
     */
    @GetMapping("/page")
    Result<PageResult<Map<String, Object>>> getUserPage(@RequestParam("page") Integer page,
                                                       @RequestParam("size") Integer size,
                                                       @RequestParam(value = "keyword", required = false) String keyword);
}